import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;

/**
 * Created by dell on 2017/8/7.
 */
public class StringNodeTest {
    public static void main(String[] args) throws IOException {
        String sc = "嘿嘿" + "哈哈" + "呵呵";
        char[] ch = new char[32];
        int hasRead = 0;
        try (
                StringReader sr = new StringReader(sc)
        ) {
            while ((hasRead = sr.read(ch)) != -1) {
                System.out.println(new String(ch, 0, hasRead));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        try (
                StringWriter sw = new StringWriter()
        ) {
            sw.write("那是你说的\r\n我们天作之合\r\n然后怎么了\r\n被时间捉弄了\r\n");
            System.out.println(sw.toString());
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}
